<html>
<head>
<title>Edit a record of 產品</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link media="all" href="/cms/css/cms.min.css" type="text/css" rel="stylesheet" /> 
<link rel="stylesheet" type="text/css" href="/cms/css/tag/token-input.css" />
<script  type="text/javascript" src="/cms/js/cms.1.1.min.js"></script>
<script type="text/javascript" src="/cms/js/tag/jquery.tokeninput.js"></script>
<script language="JavaScript" src="/cms/js/cleditor/jquery.cleditor.min.js"></script>
<!--change to auto add JS later-->
<script language="JavaScript" src="/cms/js/jquery.validate.js"></script>
<script language="JavaScript" src="/cms/js/autocomplete/textarea.js"></script>

<link media="all" href="/cms/js/jcrop/css/jquery.Jcrop.css" type="text/css" rel="stylesheet"> 
</head>

<body>
{#include file="$navigation"#}
<div style="float:right;" id="login"></div>
<script>
$(document).ready(function() {	

});	
  function validate_form(form){
	  if (validator.form())  form.submit(); else alert('Some fields has error. Please check and resubmit');
  }
</script>

<H1><span id="parent_key_label"></span>Edit a record of  產品</H1>
<form name="form_edit" id="form_edit" method="post" action="{#$self_url#}" enctype="multipart/form-data">	
<div class='tableWrapper' style="width:100%;margin:0;padding:0;">
  <div class='tableHeader' >

	<ul class="tableActions">
	
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>其他功能(請先儲存)：<a id="row_action_report_{#$edit_data.id#}" href="javascript:window.location.href='/cms/builder/product/reports.php/list/{#$edit_data.id#}'">Report</a>
<a id="row_action_application_{#$edit_data.id#}" href="javascript:window.location.href='/cms/builder/product/application.php/list/{#$edit_data.id#}'">申請</a>

<a href="javascript:window.location.href='/cms/builder/product/question.php/list/{#$edit_data.id#}'">問題/選項</a>

<a target="_blank" href="/cms/builder/product/reports_stat.php/list/{#$edit_data.id#}">報告統計</a>
	</ul>

  <div class='clear'></div>
  <div class='corner left'></div>
  <div class='corner right'></div>
  </div>	
	
<table border="0" cellspacing='0' >
<tr id="tr_id"><td><B>id</B></td>
<td id="td_id">{#$edit_data.id#}</td></tr>
<tr id="tr_name_"><td><B>產品資訊</B></td>
<td id="td_name_"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">英文名稱</td><td style="border: 0px none;" id="td_name"><input id="field_name" type="text" name="name" value="{#$edit_data.name#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">中文名稱</td><td style="border: 0px none;" id="td_cname"><input id="field_cname" type="text" name="cname" value="{#$edit_data.cname#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">品牌</td><td style="border: 0px none;" id="td_brand">{#$edit_data.brand#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">價錢</td><td style="border: 0px none;" id="td_price"><input id="field_price" type="text" name="price" value="{#$edit_data.price#}"></td></tr></table>{#$edit_data.name_#}</td></tr>
<tr id="tr_product_layout_category"><td><B>類型</B></td>
<td id="td_product_layout_category">{#$edit_data.product_layout_category#}</td></tr>
<tr id="tr_stat"><td><B>統計</B></td>
<td id="td_stat"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">人氣(點擊）</td><td style="border: 0px none;" id="td_click"><input id="field_click" type="text" name="click" value="{#$edit_data.click#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">人氣基數</td><td style="border: 0px none;" id="td_click_offset"><input id="field_click_offset" type="text" name="click_offset" value="{#$edit_data.click_offset#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">likes</td><td style="border: 0px none;" id="td_likes">{#$edit_data.likes#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">like 基數</td><td style="border: 0px none;" id="td_likes_offset"><input id="field_likes_offset" type="text" name="likes_offset" value="{#$edit_data.likes_offset#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">facebook share 基數</td><td style="border: 0px none;" id="td_fb_like_num_base"><input id="field_fb_like_num_base" type="text" name="fb_like_num_base" value="{#$edit_data.fb_like_num_base#}"></td></tr></table>{#$edit_data.stat#}</td></tr>
<tr id="tr_body"><td><B>編輯短評</B></td>
<td id="td_body"><textarea name="body" id="field_body" cols="80" rows="8">{#$edit_data.body#}</textarea></td></tr>
<tr id="tr_remark"><td><B>備註</B></td>
<td id="td_remark"><textarea name="remark" id="field_remark" cols="80" rows="4">{#$edit_data.remark#}</textarea></td></tr>
<tr id="tr_cover"><td><B>cover</B> <img src="/cms/images/ico/info.gif" class="tips" title="圖片大少：322x225 <BR/>front end will use 'cover_image1'." /></td>
<td id="td_cover">
  	<script type="text/javascript">
  	CMS.image_uplaod.show('{#$edit_data.cover_image1#}','{#$edit_data.cover_image2#}',
  	'{#$edit_data.cover_imagesize1#}','{#$edit_data.cover_imagesize2#}'); </script>
  	<BR/>
<input type="file" name="cover"> ( 支持：jpg,gif,jpeg,png)<label><input type="checkbox" name="cover_clear" value="1" />清除</label><br/></td></tr>
<tr id="tr_tag"><td><B>tag</B> <img src="/cms/images/ico/info.gif" class="tips" title="請用|分隔" /></td>
<td id="td_tag"><input id="field_tag" type="text" name="tag" value="{#$edit_data.tag#}"></td></tr>
<tr id="tr_about_url"><td><B>相關文本URL</B></td>
<td id="td_about_url"><input type="text" id="field_about_url" name="about_url"  size="80" value="{#$edit_data.about_url#}"></td></tr>
<tr id="tr_about_txt"><td><B>相關文本</B></td>
<td id="td_about_txt"><textarea name="about_txt" id="field_about_txt" cols="80" rows="4">{#$edit_data.about_txt#}</textarea></td></tr>
<tr id="tr_attribute1"><td><B>屬性1</B></td>
<td id="td_attribute1"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label1">{#$edit_data.attribute_label1#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value1"><textarea name="attribute_value1" id="field_attribute_value1" cols="80" rows="2">{#$edit_data.attribute_value1#}</textarea></td></tr></table>{#$edit_data.attribute1#}</td></tr>
<tr id="tr_attribute2"><td><B>屬性2</B></td>
<td id="td_attribute2"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label2"><input id="field_attribute_label2" type="text" name="attribute_label2" value="{#$edit_data.attribute_label2#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value2"><textarea name="attribute_value2" id="field_attribute_value2" cols="80" rows="2">{#$edit_data.attribute_value2#}</textarea></td></tr></table>{#$edit_data.attribute2#}</td></tr>
<tr id="tr_attribute3"><td><B>屬性3</B></td>
<td id="td_attribute3"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label3"><input id="field_attribute_label3" type="text" name="attribute_label3" value="{#$edit_data.attribute_label3#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value3"><textarea name="attribute_value3" id="field_attribute_value3" cols="80" rows="4">{#$edit_data.attribute_value3#}</textarea></td></tr></table>{#$edit_data.attribute3#}</td></tr>
<tr id="tr_attribute4"><td><B>屬性4</B></td>
<td id="td_attribute4"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label4"><input id="field_attribute_label4" type="text" name="attribute_label4" value="{#$edit_data.attribute_label4#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value4"><textarea name="attribute_value4" id="field_attribute_value4" cols="80" rows="4">{#$edit_data.attribute_value4#}</textarea></td></tr></table>{#$edit_data.attribute4#}</td></tr>
<tr id="tr_attribute5"><td><B>屬性5</B></td>
<td id="td_attribute5"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label5"><input id="field_attribute_label5" type="text" name="attribute_label5" value="{#$edit_data.attribute_label5#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value5"><textarea name="attribute_value5" id="field_attribute_value5" cols="80" rows="4">{#$edit_data.attribute_value5#}</textarea></td></tr></table>{#$edit_data.attribute5#}</td></tr>
<tr id="tr_attribute6"><td><B>屬性6</B></td>
<td id="td_attribute6"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label6"><input id="field_attribute_label6" type="text" name="attribute_label6" value="{#$edit_data.attribute_label6#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value6"><textarea name="attribute_value6" id="field_attribute_value6" cols="80" rows="4">{#$edit_data.attribute_value6#}</textarea></td></tr></table>{#$edit_data.attribute6#}</td></tr>
<tr id="tr_attribute7"><td><B>屬性7</B></td>
<td id="td_attribute7"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label7"><input id="field_attribute_label7" type="text" name="attribute_label7" value="{#$edit_data.attribute_label7#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value7"><textarea name="attribute_value7" id="field_attribute_value7" cols="80" rows="4">{#$edit_data.attribute_value7#}</textarea></td></tr></table>{#$edit_data.attribute7#}</td></tr>
<tr id="tr_attribute8"><td><B>屬性8</B></td>
<td id="td_attribute8"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">名稱</td><td style="border: 0px none;" id="td_attribute_label8"><input id="field_attribute_label8" type="text" name="attribute_label8" value="{#$edit_data.attribute_label8#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">內容</td><td style="border: 0px none;" id="td_attribute_value8"><textarea name="attribute_value8" id="field_attribute_value8" cols="80" rows="4">{#$edit_data.attribute_value8#}</textarea></td></tr></table>{#$edit_data.attribute8#}</td></tr>
<tr id="tr_questions_json"><td><B>申請試用的問題</B> <img src="/cms/images/ico/info.gif" class="tips" title="申請試用的問題，json格式 可以保存單選 多選 圖片 文字等問題" /></td>
<td id="td_questions_json">{#$edit_data.questions_json#}</td></tr>
<tr id="tr_is_live"><td><B>公開</B> <img src="/cms/images/ico/info.gif" class="tips" title="產品只於<BR/>is_live=1 && status=1<BR/>時於前台顯示 " /></td>
<td id="td_is_live">{#$edit_data.is_live#}</td></tr>
<tr id="tr_reports"><td><B>報告數目</B></td>
<td id="td_reports">{#$edit_data.reports#}</td></tr>
<tr id="tr_release_time"><td><B>產品推出時間</B></td>
<td id="td_release_time"><input type="text" name="release_time" value="{#$edit_data.release_time#}" id="datepicker_release_time">
<script type="text/javascript">
	$(function() {
		$("#datepicker_release_time").datepicker(
		{dateFormat: 'yy-mm-dd', 
		    numberOfMonths: 2,
		    showOtherMonths: true, selectOtherMonths: true,
			changeMonth: true, changeYear: true,  
            showWeek: true,			
			showButtonPanel: true
          }
		);
	});
</script>
</td></tr>
<tr id="tr_is_trial"><td><B>試用</B></td>
<td id="td_is_trial">{#$edit_data.is_trial#}</td></tr>
<tr id="tr_trial_detail"><td><B>試用詳情</B></td>
<td id="td_trial_detail"><table class="inner" style="border:0"><tr class="innerrow"><td style="border: 0px none;">試用容量</td><td style="border: 0px none;" id="td_capacity_trial"><input id="field_capacity_trial" type="text" name="capacity_trial" value="{#$edit_data.capacity_trial#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">試用會員分類</td><td style="border: 0px none;" id="td_member_type">{#$edit_data.member_type#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">推介</td><td style="border: 0px none;" id="td_trial_hilite_type">{#$edit_data.trial_hilite_type#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">試用條款</td><td style="border: 0px none;" id="td_trial_terms"><textarea name="trial_terms" id="field_trial_terms" cols="80" rows="6">{#$edit_data.trial_terms#}</textarea></td></tr>
<tr class="innerrow"><td style="border: 0px none;">points</td><td style="border: 0px none;" id="td_points"><input id="field_points" type="text" name="points" value="{#$edit_data.points#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">試用名額</td><td style="border: 0px none;" id="td_quota"><input id="field_quota" type="text" name="quota" value="{#$edit_data.quota#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">申請人數基數</td><td style="border: 0px none;" id="td_apply_num_offset"><input id="field_apply_num_offset" type="text" name="apply_num_offset" value="{#$edit_data.apply_num_offset#}"></td></tr>
<tr class="innerrow"><td style="border: 0px none;">申請人數</td><td style="border: 0px none;" id="td_apply_num">{#$edit_data.apply_num#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">評價項目</td><td style="border: 0px none;" id="td_vote_option">{#$edit_data.vote_option#}</td></tr>
<tr class="innerrow"><td style="border: 0px none;">申請試用開始時間</td><td style="border: 0px none;" id="td_apply_starttime"><input type="text" name="apply_starttime" value="{#$edit_data.apply_starttime#}" id="datepicker_apply_starttime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_apply_starttime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr class="innerrow"><td style="border: 0px none;">申請試用結束時間</td><td style="border: 0px none;" id="td_apply_endtime"><input type="text" name="apply_endtime" value="{#$edit_data.apply_endtime#}" id="datepicker_apply_endtime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_apply_endtime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr class="innerrow"><td style="border: 0px none;">提交報告開始時間</td><td style="border: 0px none;" id="td_report_starttime"><input type="text" name="report_starttime" value="{#$edit_data.report_starttime#}" id="datepicker_report_starttime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_report_starttime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr class="innerrow"><td style="border: 0px none;">提交報告結束時間</td><td style="border: 0px none;" id="td_report_endtime"><input type="text" name="report_endtime" value="{#$edit_data.report_endtime#}" id="datepicker_report_endtime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_report_endtime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr></table>{#$edit_data.trial_detail#}</td></tr>
<tr id="tr_addedby"><td><B>建立者</B></td>
<td id="td_addedby">{#$edit_data.addedby#}</td></tr>
<tr id="tr_modifiedby"><td><B>更新者</B></td>
<td id="td_modifiedby">{#$edit_data.modifiedby#}</td></tr>
<tr id="tr_approvedby"><td><B>審核者</B></td>
<td id="td_approvedby">{#$edit_data.approvedby#}</td></tr>
<tr id="tr_status"><td><B>上線狀態</B></td>
<td id="td_status">{#$edit_data.status#}</td></tr>
<tr id="tr_addtime"><td><B>建立時間</B></td>
<td id="td_addtime">{#$edit_data.addtime#}</td></tr>
<tr id="tr_lastmodify"><td><B>更新時間</B></td>
<td id="td_lastmodify">{#$edit_data.lastmodify#}</td></tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="hidden" name="id" value="{#$edit_data.id#}">
     	
    <input type="hidden" name="action" value="update"><input name="subaction" type="hidden">
	<ul class="tableActions">
    
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>其他功能(請先儲存)：<a id="row_action_report_{#$edit_data.id#}" href="javascript:window.location.href='/cms/builder/product/reports.php/list/{#$edit_data.id#}'">Report</a>
<a id="row_action_application_{#$edit_data.id#}" href="javascript:window.location.href='/cms/builder/product/application.php/list/{#$edit_data.id#}'">申請</a>

<a href="javascript:window.location.href='/cms/builder/product/question.php/list/{#$edit_data.id#}'">問題/選項</a>

<a target="_blank" href="/cms/builder/product/reports_stat.php/list/{#$edit_data.id#}">報告統計</a>
	</ul>
  </td>
  </tr>
</table>

</form> 

<script type="text/javascript">
$(function(){
  $(".tips").tipTip({defaultPosition: "right", edgeOffset: 10});
});
</script>

<script type="text/javascript">

function hidden_rows_by_type(type){

  var myArray = [
    [] ,  // show this when value = 0;
    ['trial_detail'], // show this when value = 1
  ];

  for (var i=0; i<myArray.length; i++) {
    if (type == i ){
       for (var j=0; j<myArray[i].length; j++){
         $('#tr_'+myArray[i][j]).show();
       }
    } else {
       for (var j=0; j<myArray[i].length; j++){
        $('#tr_'+myArray[i][j]).hide();
       }
    }
  }
}

$(document).ready(function() {	
	var type = parseInt($('[name|="is_trial"]').val());
	hidden_rows_by_type(type);

	$('[name|="is_trial"]').change(function() {
		hidden_rows_by_type(parseInt($(this).val()));
	});

$("#field_attribute_label1").attr('readonly', 'yes');

});

</script>
<!--POSTRUNJS-->
</body>
</html>
